<?php

	session_name("wlan");
	session_start();
	
	require_once("../../../../global/functions/config.php");

	/* load settings */
	loadConfig("../../../../../");
	
	if ($_SESSION['loggedin']) {
		
		header('Content-type: text/plain');
		header('Content-Disposition: attachment; filename="'.$file.'.txt"');
		header("Content-Length: ".filesize(config("root")."data/logs/".$file));
		header("Pragma: private");

		$file = str_replace("..", "", $_GET['file']);

		readfile(config("root")."data/logs/".$file);
		
	} else {
		echo "ERROR: not logged in!";
	}

?>